package com.mall.huohuo.process;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zycoding
 * @version Pipline.java, v 0.1 2020-08-17 21:18 zycoding
 */

public class Pipeline {

    private List<Node> nodeList = new ArrayList<>();

    private int current;

    public Pipeline() {
    }

    public void registryNode(Node node) {
        nodeList.add(node);
    }

    public void invoke(NodeContext context) {

        if (current < nodeList.size()) {
            nodeList.get(current++).invoke(context);
        }
    }


}
